''========================================================
'' Autor: 		Luis Antonio Lara Capetillo
'' Fecha Creación: 	27/9/2012
'' Descripcion: 	Clase Componente ctlGridContenedores
''========================================================

Public Class ctlGridContenedores

	  Public Event btnnidClicked As EventHandler
	  Public Event btnnidProductoClicked As EventHandler
	  Public Event btnnidPuertoClicked As EventHandler
	  Public Event btnnidAreaClicked As EventHandler
	  Public Event btnestadoClicked As EventHandler
	  Public Event btncapacidadClicked As EventHandler
	  Public Event btnpesoClicked As EventHandler
	  Public Event btntipo_ManiobraClicked As EventHandler
	  Public Event btnnidEmpresasClicked As EventHandler
	  Public Event btnnidEmpresamanClicked As EventHandler
	  Public Event btnnidSelected As EventHandler
	  Public Event btnnidPage As GridViewPageEventHandler

#Region "Propiedades"

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblnidProducto
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblnidProductoTitulo() As String
    Get
      Return Me.lblnidProducto.Text
    End Get
    Set(value As String)
      Me.lblnidProducto.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblnidPuerto
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblnidPuertoTitulo() As String
    Get
      Return Me.lblnidPuerto.Text
    End Get
    Set(value As String)
      Me.lblnidPuerto.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblnidArea
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblnidAreaTitulo() As String
    Get
      Return Me.lblnidArea.Text
    End Get
    Set(value As String)
      Me.lblnidArea.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblestado
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblestadoTitulo() As String
    Get
      Return Me.lblestado.Text
    End Get
    Set(value As String)
      Me.lblestado.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblcapacidad
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblcapacidadTitulo() As String
    Get
      Return Me.lblcapacidad.Text
    End Get
    Set(value As String)
      Me.lblcapacidad.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblpeso
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblpesoTitulo() As String
    Get
      Return Me.lblpeso.Text
    End Get
    Set(value As String)
      Me.lblpeso.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblganchos
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblganchosTitulo() As String
    Get
      Return Me.lblganchos.Text
    End Get
    Set(value As String)
      Me.lblganchos.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lbltipo_Maniobra
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lbltipo_ManiobraTitulo() As String
    Get
      Return Me.lbltipo_Maniobra.Text
    End Get
    Set(value As String)
      Me.lbltipo_Maniobra.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblcantidad
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblcantidadTitulo() As String
    Get
      Return Me.lblcantidad.Text
    End Get
    Set(value As String)
      Me.lblcantidad.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblnidEmpresas
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblnidEmpresasTitulo() As String
    Get
      Return Me.lblnidEmpresas.Text
    End Get
    Set(value As String)
      Me.lblnidEmpresas.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o establece el texto que contiene la etiqueta lblnidEmpresaman
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property lblnidEmpresamanTitulo() As String
    Get
      Return Me.lblnidEmpresaman.Text
    End Get
    Set(value As String)
      Me.lblnidEmpresaman.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor nidProducto del TextBox txtnidProducto
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property nidProducto() As String
    Get
      Return Me.txtnidProducto.Text
    End Get
    Set(value As String)
      Me.txtnidProducto.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor nidPuerto del TextBox txtnidPuerto
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property nidPuerto() As String
    Get
      Return Me.txtnidPuerto.Text
    End Get
    Set(value As String)
      Me.txtnidPuerto.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor nidArea del TextBox txtnidArea
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property nidArea() As String
    Get
      Return Me.txtnidArea.Text
    End Get
    Set(value As String)
      Me.txtnidArea.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor estado del TextBox txtestado
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property estado() As String
    Get
      Return Me.txtestado.Text
    End Get
    Set(value As String)
      Me.txtestado.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor capacidad del TextBox txtcapacidad
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property capacidad() As String
    Get
      Return Me.txtcapacidad.Text
    End Get
    Set(value As String)
      Me.txtcapacidad.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor peso del TextBox txtpeso
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property peso() As String
    Get
      Return Me.txtpeso.Text
    End Get
    Set(value As String)
      Me.txtpeso.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor ganchos del TextBox txtganchos
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property ganchos() As String
    Get
      Return Me.txtganchos.Text
    End Get
    Set(value As String)
      Me.txtganchos.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor tipo_Maniobra del TextBox txttipo_Maniobra
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property tipo_Maniobra() As String
    Get
      Return Me.txttipo_Maniobra.Text
    End Get
    Set(value As String)
      Me.txttipo_Maniobra.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor cantidad del TextBox txtcantidad
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property cantidad() As String
    Get
      Return Me.txtcantidad.Text
    End Get
    Set(value As String)
      Me.txtcantidad.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor nidEmpresas del TextBox txtnidEmpresas
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property nidEmpresas() As String
    Get
      Return Me.txtnidEmpresas.Text
    End Get
    Set(value As String)
      Me.txtnidEmpresas.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Obtiene o estable el valor nidEmpresaman del TextBox txtnidEmpresaman
  ''' </summary>
  ''' <value>valor tipo String</value>
  ''' <returns>valor tipo String</returns>
  ''' <remarks></remarks>
  Public Property nidEmpresaman() As String
    Get
      Return Me.txtnidEmpresaman.Text
    End Get
    Set(value As String)
      Me.txtnidEmpresaman.Text = value
    End Set
  End Property

  ''' <summary>
  ''' Habilita o Desabilita el Control para Edicion
  ''' </summary>
  ''' <value>True o False</value>
  ''' <remarks></remarks>
  Public WriteOnly Property Enabled() As Boolean
    Set(value As Boolean)
	  btnnid.Enabled=value
      txtnidProducto.Enabled=value
      btnnidProducto.Enabled=value
      txtnidPuerto.Enabled=value
      btnnidPuerto.Enabled=value
      txtnidArea.Enabled=value
      btnnidArea.Enabled=value
      txtestado.Enabled=value
      btnestado.Enabled=value
      txtcapacidad.Enabled=value
      btncapacidad.Enabled=value
      txtpeso.Enabled=value
      btnpeso.Enabled=value
      txtganchos.Enabled=value
      txttipo_Maniobra.Enabled=value
      btntipo_Maniobra.Enabled=value
      txtcantidad.Enabled=value
      txtnidEmpresas.Enabled=value
      btnnidEmpresas.Enabled=value
      txtnidEmpresaman.Enabled=value
      btnnidEmpresaman.Enabled=value
      btnnid.Enabled=value
      
    End Set
  End Property

  ''' <summary>
  ''' Habilita o Desabilita el Control para solo lectura
  ''' </summary>
  ''' <value>True o False</value>
  ''' <remarks>ReadOnly</remarks>
  Public WriteOnly Property Lectura() As Boolean
    Set(value As Boolean)
	  btnnid.ReadOnly=value
      txtnidProducto.ReadOnly=value
      btnnidProducto.ReadOnly=value
      txtnidPuerto.ReadOnly=value
      btnnidPuerto.ReadOnly=value
      txtnidArea.ReadOnly=value
      btnnidArea.ReadOnly=value
      txtestado.ReadOnly=value
      btnestado.ReadOnly=value
      txtcapacidad.ReadOnly=value
      btncapacidad.ReadOnly=value
      txtpeso.ReadOnly=value
      btnpeso.ReadOnly=value
      txtganchos.ReadOnly=value
      txttipo_Maniobra.ReadOnly=value
      btntipo_Maniobra.ReadOnly=value
      txtcantidad.ReadOnly=value
      txtnidEmpresas.ReadOnly=value
      btnnidEmpresas.ReadOnly=value
      txtnidEmpresaman.ReadOnly=value
      btnnidEmpresaman.ReadOnly=value
      btnnid.ReadOnly=value
      
    End Set
  End Property


#End Region
#Region "Eventos"
  Protected Sub btnnid_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnnid.Click
    OnbtnnidClick(sender)
  End Sub

  Protected Sub btnnidProducto_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnnidProducto.Click
    OnbtnnidProductoClick(sender)
  End Sub

  Protected Sub btnnidPuerto_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnnidPuerto.Click
    OnbtnnidPuertoClick(sender)
  End Sub

  Protected Sub btnnidArea_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnnidArea.Click
    OnbtnnidAreaClick(sender)
  End Sub

  Protected Sub btnestado_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnestado.Click
    OnbtnestadoClick(sender)
  End Sub

  Protected Sub btncapacidad_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btncapacidad.Click
    OnbtncapacidadClick(sender)
  End Sub

  Protected Sub btnpeso_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnpeso.Click
    OnbtnpesoClick(sender)
  End Sub

  Protected Sub btntipo_Maniobra_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btntipo_Maniobra.Click
    Onbtntipo_ManiobraClick(sender)
  End Sub

  Protected Sub btnnidEmpresas_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnnidEmpresas.Click
    OnbtnnidEmpresasClick(sender)
  End Sub

  Protected Sub btnnidEmpresaman_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnnidEmpresaman.Click
    OnbtnnidEmpresamanClick(sender)
  End Sub

  ''' <summary>
  ''' Evento que se genera cuando se selecciona un objeto del btnnid
  ''' </summary>
  ''' <param name="sender"> es un Object</param>
  ''' <param name="e"> es de tipo EventArgs</param>
  ''' <remarks></remarks>
  Protected Sub btnnid_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles btnnid.SelectedIndexChanged
    OngvDatosClick(sender)
  End Sub
  ''' <summary>
  ''' Evento que se genera cuando se selecciona una pagina del btnnid
  ''' </summary>
  ''' <param name="sender"> es un Object</param>
  ''' <param name="e"> es de tipo GridViewPageEventArgs</param>
  ''' <remarks></remarks>
  Protected Sub btnnid_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles btnnid.PageIndexChanging
    OngvSelectionPage(sender, e.NewPageIndex)
  End Sub

#End Region
#Region "Metodos"
  Protected Overridable Sub OnbtnnidClick(ByVal sender As Object)
    RaiseEvent btnnidClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidProductoClick(ByVal sender As Object)
    RaiseEvent btnnidProductoClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidPuertoClick(ByVal sender As Object)
    RaiseEvent btnnidPuertoClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidAreaClick(ByVal sender As Object)
    RaiseEvent btnnidAreaClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnestadoClick(ByVal sender As Object)
    RaiseEvent btnestadoClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtncapacidadClick(ByVal sender As Object)
    RaiseEvent btncapacidadClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnpesoClick(ByVal sender As Object)
    RaiseEvent btnpesoClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub Onbtntipo_ManiobraClick(ByVal sender As Object)
    RaiseEvent btntipo_ManiobraClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidEmpresasClick(ByVal sender As Object)
    RaiseEvent btnnidEmpresasClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidEmpresamanClick(ByVal sender As Object)
    RaiseEvent btnnidEmpresamanClicked(sender, New EventArgs)
  End Sub

  Protected Overridable Sub OnbtnnidClick(ByVal sender As Object)
    RaiseEvent btnnidSelected(sender, New EventArgs)
  End Sub
  Protected Overridable Sub OnbtnnidSelectionPage(sender As Object, ByVal index As Integer)
    RaiseEvent btnnidPage(sender, New GridViewPageEventArgs(index))
  End Sub

  ''' <summary>
  ''' Metodo para asignar los datos al componente ctlTurismo
  ''' </summary>
  ''' <param name="tablaDatos">DataTable donde se obtienen los datos</param>
  ''' <remarks></remarks>
  Public Sub AsignarDatos(ByVal tablaDatos As DataTable)
    Me.txtnidProducto.Text= tablaDatos.Rows(0)("nidProducto").ToString
    Me.txtnidPuerto.Text= tablaDatos.Rows(0)("nidPuerto").ToString
    Me.txtnidArea.Text= tablaDatos.Rows(0)("nidArea").ToString
    Me.txtestado.Text= tablaDatos.Rows(0)("estado").ToString
    Me.txtcapacidad.Text= tablaDatos.Rows(0)("capacidad").ToString
    Me.txtpeso.Text= tablaDatos.Rows(0)("peso").ToString
    Me.txtganchos.Text= tablaDatos.Rows(0)("ganchos").ToString
    Me.txttipo_Maniobra.Text= tablaDatos.Rows(0)("tipo_Maniobra").ToString
    Me.txtcantidad.Text= tablaDatos.Rows(0)("cantidad").ToString
    Me.txtnidEmpresas.Text= tablaDatos.Rows(0)("nidEmpresas").ToString
    Me.txtnidEmpresaman.Text= tablaDatos.Rows(0)("nidEmpresaman").ToString
  End Sub

  ''' <summary>
  ''' Metodo para llenar el btnnid con datos de la table
  ''' </summary>
  ''' <param name="tabla">tabla donde se obtienen los datos</param>
  ''' <remarks></remarks>
  Public Sub llenarbtnnid(ByVal tabla As DataTable)
    Me.gvDatos.DataSource = tabla
    Me.gvDatos.DataBind()
  End Sub
  ''' <summary>
  ''' Metodo para Seleccionar la pagina de el btnnid
  ''' </summary>
  ''' <param name="e">es un evento de tipo GridViewPageEventArgs</param>
  ''' <remarks></remarks>
  Public Sub SelecPagebtnnid(ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs)
    Me.btnnid.PageIndex = e.NewPageIndex
    Me.btnnid.DataBind()
  End Sub

#End Region
End Class
